fix(ci): make cppcheck gate robust to cppcheck 2.21 + bump flake.lock#22
Merged
Conversation
The nightly lockfile-update job bumps nixpkgs, which moved cppcheck 2.18 -> 2.21. cppcheck 2.21 changed two behaviours that broke the test gate (so the auto-update PR never opened): - It now hard-errors (syntaxError) when a #if condition invokes a function-like macro it cannot expand. zephyr_hardware.cpp gates the battery-check ADC code on Zephyr devicetree macros (DT_NODE_EXISTS / DT_PATH / DT_NODE_HAS_PROP); standalone cppcheck has no DT headers, so it cannot evaluate them. Older cppcheck assumed 0 and moved on. Suppress syntaxError for that one file; real syntax is still validated by the Zephyr compiler in the smoke-build gate. - It flags StatusInput's scalar members as uninitialised (uninitMemberVarNoCtor). Give them default member initializers, which is correct hygiene and zero behavioural change (callers overwrite). Bump flake.lock (nixpkgs -> 2026-06-16, git-hooks -> 2026-06-17) so the 2.21 toolchain lands and is validated here. checks.default is green: cppcheck + clang-format + 317/317 host tests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The nightly Update lockfiles job has been failing intermittently (Jun 1 ✗, Jun 8 ✓, Jun 15 ✗, Jun 22 ✗) because each run rolls a different
nixpkgs, and recent revs ship cppcheck 2.21.0 (vs 2.18.3 on the currentmainlock). 2.21.0 changed two behaviours that trip themockingbeacon-cppchecktest gate, so the auto-update PR never opens.Reproduced exactly by pulling cppcheck 2.21.0 from the failing run's nixpkgs (
3e41b24).Two findings under cppcheck 2.21.0
syntaxError—src/zephyr_hardware.cpp:54(false positive). 2.21 hard-errors when a#ifinvokes a function-like macro it can't expand. That line gates the battery-check ADC code on Zephyr devicetree macros (DT_NODE_EXISTS/DT_PATH/DT_NODE_HAS_PROP); standalone cppcheck has no DT headers, so it can't evaluate them. Older cppcheck assumed0and moved on. → suppresssyntaxErrorfor that one file. Real syntax is still validated by the Zephyr compiler in the smoke-build step.uninitMemberVarNoCtor×5 —src/beacon_logic.hpp. 2.21 flagsStatusInput's scalar members as uninitialised. → default member initializers (= 0); correct hygiene, zero behavioural change (callers overwrite).Also
Bumps
flake.lock(nixpkgs→ 2026-06-16 / cppcheck 2.21.0,git-hooks→ 2026-06-17) so the new toolchain lands and is validated in this PR rather than waiting on the next scheduled run.west2nix.tomlis intentionally untouched — that's the Zephyr/west side, refreshed separately by the scheduled job's own step.Validation
nix build .#checks.defaultis green against the bumped lock: cppcheck (2.21.0) + clang-format + 317/317 host-test assertions.